#define _CRT_SECURE_NO_WARNINGS 1

bool isSameTree(struct TreeNode* p, struct TreeNode* q) {
    if (p == NULL && q == NULL)
        return true;
    if (p == NULL || q == NULL)
        return false;
    if (p->val != q->val)
        return false;
    return isSameTree(p->left, q->left) && isSameTree(p->right, q->right);

}

bool _checkSymmetricTree(struct TreeNode* left, struct TreeNode* right)
{
    if (left == NULL && right == NULL)
        return true;
    if (left == NULL || right == NULL)
        return false;
    if (left->val != right->val)
        return false;
    return  _checkSymmetricTree(left->left, right->right)
        && _checkSymmetricTree(left->right, right->left);
}

bool checkSymmetricTree(struct TreeNode* root) {
    if (root == NULL)
        return true;
    return _checkSymmetricTree(root->left, root->right);
}